package otherTest;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author zhiqi.shao
 * @Date 2018/5/31 14:06
 */
public class Test1 {

    @Test
    public void testContain() {
        String deptId = "123";
//        List<String> deptIds=null;

//        deptIds.contains(deptId);
        //NullPointerException
        List<String> deptIds1 = new ArrayList<>();
        deptIds1.contains(deptId);
    }


    @Test
    public void testForRemove(){
        List<String> orgin=new ArrayList<>();
        orgin.add("1");
        orgin.add("3");
        orgin.add("6g");
        orgin.add("7g");
       /* orgin.forEach(d->{
            orgin.remove(d);
        });*/
        //ConcurrentModificationException

        Iterator<String> it = orgin.iterator();
        while (it.hasNext()) {
            if ("6g".equals(it.next())) {
                it.remove();
            }
        }
        System.out.println(orgin.size());
    }
}
